package com.example.dto;

import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.util.Date;

/**
 * 座位预约响应DTO
 * 
 * @author HP
 * @description 用于返回座位预约信息的数据传输对象
 * @createDate 2025-08-26 19:36:00
 */
@Data
@Schema(description = "座位预约响应")
public class SeatReservationResponseDTO {

    @Schema(description = "预约ID", example = "1")
    private Long id;

    @Schema(description = "座位ID", example = "1")
    private Long seatId;

    @Schema(description = "座位编号", example = "A001")
    private String seatNumber;

    @Schema(description = "房间ID", example = "1")
    private Long roomId;

    @Schema(description = "房间名称", example = "自习室101")
    private String roomName;

    @Schema(description = "用户ID", example = "1")
    private Long userId;

    @Schema(description = "用户名", example = "张三")
    private String username;

    @Schema(description = "预约时间", example = "2025-08-26 08:30:00")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date reservationTime;

    @Schema(description = "开始时间", example = "09:00:00")
    @JsonFormat(pattern = "HH:mm:ss", timezone = "GMT+8")
    private Date startTime;

    @Schema(description = "结束时间", example = "18:00:00")
    @JsonFormat(pattern = "HH:mm:ss", timezone = "GMT+8")
    private Date endTime;

    @Schema(description = "签到时间", example = "09:05:00")
    @JsonFormat(pattern = "HH:mm:ss", timezone = "GMT+8")
    private Date signTime;

    @Schema(description = "预约状态", example = "0")
    private Integer reservationStatus;

    @Schema(description = "预约状态描述", example = "待签到")
    private String reservationStatusDesc;

    @Schema(description = "是否可以取消", example = "true")
    private Boolean canCancel;

    @Schema(description = "是否可以签到", example = "true")
    private Boolean canCheckIn;

    @Schema(description = "备注信息", example = "学习计划")
    private String remark;

    /**
     * 获取预约状态描述
     */
    public String getReservationStatusDesc() {
        if (reservationStatus == null) {
            return "未知状态";
        }
        switch (reservationStatus) {
            case 0:
                return "待签到";
            case 1:
                return "已签到";
            case 2:
                return "已取消";
            case 3:
                return "已超时";
            default:
                return "未知状态";
        }
    }
}